package com.mia.props;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;

public enum TabProps {
   Main(508),
   Art(328),
   Bathroom(320),
   Bedroom(309),
   Misc(1117),
   Dungeon(493),
   Architecture(332),
   Food(275),
   Holiday(147),
   Kitchen(453),
   Lighting(244),
   Livingroom(466),
   Market(809),
   Office(329),
   Patreon(443),
   Plants(1659),
   Religion(470),
   Science(187),
   Signs(189),
   Sports(461),
   Storage(317),
   Tech(474),
   Toys(278),
   Trophies(518),
   Yard(75);

   private TabProps.PropTab tab;

   private TabProps(int meta) {
      this.tab = new TabProps.PropTab(meta);
   }

   public TabProps.PropTab get() {
      return this.tab;
   }

   public static CreativeTabs[] getAll() {
      CreativeTabs[] tabs = new CreativeTabs[values().length + 1];
      tabs[0] = CreativeTabs.tabAllSearch;

      for(int i = 0; i < values().length; ++i) {
         tabs[i + 1] = values()[i].get();
      }

      return tabs;
   }

   class PropTab extends CreativeTabs {
      private int meta;
      private ItemStack icon;

      public PropTab(int meta) {
         super("props." + TabProps.this.name());
         this.meta = meta;
      }

      public Item getTabIconItem() {
         return Props.itemProps;
      }

      @SideOnly(Side.CLIENT)
      public ItemStack getIconItemStack() {
         if (this.icon == null) {
            this.icon = new ItemStack(Props.itemProps, 1, this.meta);
         }

         return this.icon;
      }
   }
}
